home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Http Server / •OT_Classes / TNetworkSession.h < prev    next >
Encoding:
Text File  |  1996-01-11  |  2.6 KB  |  87 lines  |  [TEXT/CWIE]

  1. //    TNetworkSession.h - Macintosh OpenTransport Network Session class object
  2. // 
  3. // Apple Macintosh Developer Technical Support
  4. // Written by:  Vinne Moscaritolo
  5. //
  6. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  7. //
  8. // You may incorporate this sample code into your applications without
  9. // restriction, though the sample code has been provided "AS IS" and the
  10. // responsibility for its operation is 100% yours.  However, what you are
  11. // not permitted to do is to redistribute the source as "DSC Sample Code"
  12. // after having made changes. If you're going to re-distribute the source,
  13. // we require that you make it clear in the source that the code was
  14. // descended from Apple Sample Code, but that you've made changes.
  15. // 
  16.  
  17. #ifndef _H_TNetworkSession
  18. #define _H_TNetworkSession
  19.  
  20. #include "TNetworkEventHandler.h"
  21. #include "TNetworkStream.h"
  22. #include "TThread.h"        
  23.  
  24. class  TNetworkAcceptor;
  25.  
  26. // Local Prototypes
  27.  
  28. //
  29. // TNetworkSession  - OpenTransport Network Session class 
  30. //
  31. class TNetworkSession : public TLink, TNetworkEventHandler, public TThread 
  32. {
  33. //     CONSTRUCTORS AND DESTRUCTORS
  34. public:
  35.                      TNetworkSession(TNetworkAcceptor*);
  36.     virtual    ~TNetworkSession();
  37.             
  38. // CALLBACKS        
  39. protected:
  40. //        virtual    void*    Run();
  41.  
  42. // ACCESSORS
  43. public:
  44.         EndpointRef        GetEndpoint()         { return fEndPoint; };
  45.         TCall*                GetCallInfo()         { return &fCallInfo; };
  46.         TDiscon*            GetDisconInfo()     { return &fDisconInfo; };
  47. TNetworkIOStream&    GetStreamRef()     { return fioStream; };
  48.         
  49. // FUNCTIONS FROM TThread
  50. private:
  51.     void Done();
  52.  
  53. // FUNCTIONS FROM TNetworkEventHandler
  54. private:
  55.     void     HandleEvent(TNetworkEvent* );
  56.  
  57. // EVENT MANGEMENT FUNCTIONS
  58. private:
  59.     void EventOpenComplete          (TNetworkEvent* );
  60.     void EventPassCon                     (TNetworkEvent* );
  61.     void EventDisconnect                (TNetworkEvent* );
  62.     void EventOrdRelease              (TNetworkEvent* );
  63.     void EventDisconnectComplete(TNetworkEvent* );
  64.     void EventUnbindComplete      (TNetworkEvent* );
  65.     void EventExDataAvail                (TNetworkEvent* );
  66.     void EventMemoryReleased        (TNetworkEvent* );
  67.     void EventOther                            (TNetworkEvent* );        // Debug event
  68.     void EventDataAvail                    (TNetworkEvent* = nil);    
  69.  
  70. // OPEN TRANSPORT CALLBACK
  71.     static pascal void NotifyProc (TNetworkSession* , OTEventCode , OTResult , void* );
  72.  
  73. // PROTECTED FIELDS
  74. protected:
  75.     EndpointRef             fEndPoint;                    // Endpoint ref
  76.     TEndpointInfo            fInfo;                            // Endpoint information
  77.     TNetworkIOStream    fioStream;
  78.     TNetworkAcceptor*    fServer;                        // back pointer to server info
  79.     ThreadTaskRef            fThreadTaskRef;            // thread task ref
  80.     TCall                         fCallInfo;
  81.     TDiscon                        fDisconInfo;
  82.     UInt8*                        fData;
  83. };
  84.  
  85.  
  86. #endif
  87.